package proyectoia;

import IA.DistFS.Servers;
import aima.search.framework.GoalTest;
import aima.search.framework.HeuristicFunction;
import aima.search.framework.Search;
import aima.search.framework.SuccessorFunction;
import aima.search.informed.HillClimbingSearch;
import java.util.logging.Level;
import java.util.logging.Logger;

public class StagedExperiment6 extends StagedExperiment {

    public StagedExperiment6(int seed, int nIterations) {
        super(seed, nIterations);
        numStages = 3;
    }

    @Override
    protected int getNumUsers() {
        return 200;
    }

    @Override
    protected int getNumRequests() {
        return 5;
    }

    @Override
    protected int getNumServers() {
        return 50;
    }

    @Override
    protected int getNumReplications() {
        return 5;
    }

    @Override
    protected DistFileSystemState getInitialSolution(DistFileSystemState state) {
        state.generateGreedySolution();
        return state;
    }

    @Override
    protected Search getSearch() {
        return new HillClimbingSearch();
    }

    @Override
    protected SuccessorFunction getSuccessor() {
        switch (currentStage) {
            case 0:
                return new DistFileSystemSuccessorFunction1();
            case 1:
                return new DistFileSystemSuccessorFunction2();
            case 2:
                return new DistFileSystemSuccessorFunction2b();
        }
        return null;
    }

    @Override
    protected GoalTest getGoalTest() {
        return new DistFileSystemGoalTest();
    }

    @Override
    protected HeuristicFunction getHeuristic() {
        return new DistFileSystemHeuristicFunction1();
    }
    
    public static void main(String[] args) throws Servers.WrongParametersException {
        StagedExperiment se = new StagedExperiment6(123, 2);
        try {
            se.initialitze();
            se.execute();
            se.printSlowestServerTime("experiment-6");
        } catch (Exception e) {
            Logger.getLogger(DistFileSystem.class.getName()).log(Level.SEVERE, null, e);
        }
    }
}
